-- function getTableVal(tablex,keyA,keyB,defaultv)
--     if tablex[keyA]==nil then
--         return defaultv
--     end
--     if tablex[keyA][keyB]==nil then
--         return defaultv
--     end
--     return  tablex[keyA][keyB]
-- end    


local rs={name="knife",enh_n=2,lvl=80,field={atk=21,def=2},p_skill={"fanghuo","jienue"},a_skill="267X"}  --skill={"fanghuo","jienue"}
local ta={enh_n=1,field={atk=10,def=20},p_skill={"niuma","tianhe"},dt_enh={dark=17,poison=15}}  --skill={"niuma","tianhe"}
local tb={enh_n=2,field={atk=15,def=10},dt_res={fire=10,ice=20},a_skill="889X"} --



require "lua_test.lua_map.map.scripts.tools.printx"
require "lua_test.lua_map.map.scripts.constant.enum"
require "lua_test.lua_map.map.scripts.tools.lcommon"

local xxv=getTableVal(rs,-1,"field","atk")
print(xxv)

--
mergeFieldTable(UNIT_FIELD_M_TYPE,rs,tb,ta)

printTable(rs)



local xx1={enh_n=2,field={atk=15,def=10},dt_res={fire=10,ice=20}}
local xx2=tableCopy(xx1)

xx1=nil
if xx1==nil then
    print("已经销毁xx1--------")
end


local yy=require "lua_test.lua_map.notinmaptest.yuan"
yy:init()
-- local ys=require "lua_test.lua_map.notinmaptest.yuan"
-- ys:gg()
-- print(fields)



local item_configx=require "lua_test.lua_map.map.scripts.config.item_config"

for i, v in pairs(UNIT_FIELD_M_TYPE) do
  local mtfield=item_configx.I02X[i]
  --printTable(v)
  if mtfield~=nil and v.cunitf then  --cunitf只执行改变影响单位属性变化的项
      for fk,fv in pairs(mtfield) do
          print("I02X:"..tostring(fk)..","..tostring(fv))
      end    
  end
end    



function getADisXYX(x,y,anglec,dis)
	return (x+dis * anglec),(y+dis * anglec)
end	

--local BJ=require "lua_test.lua_map.map.scripts.tools.blz_j"
local x2=1
local y2=3
print("x2,y2",x2,y2)
x2,y2=getADisXYX(0,0,(45),150)
print("x2,y2",x2,y2)





--printTable(xx2)


-- function fwrite(fmt,fmt2, ...)  ---> 固定的参数fmt
--     print(fmt)
--     print(fmt2)
--     local arg={...}
--     local argnum=select("#",...)
--     print(argnum) 
--     for i,v in ipairs(arg)do
--       print(v)
--     end    
-- end


-- fwrite("xxx","uu","k1","k2","ddd")




-- function getItemFieldStr(itemx)
--     local rs_str=""
--     for i, v in pairs(UNIT_FIELD_M_TYPE) do
--         local m_t_field=itemx[i]
--         if m_t_field~=nil then
--             for fk,fv in pairs(m_t_field) do
--                 --rs_str=rs_str..","..UNIT_FIELD[fk].name..":0"
--                 local fenum=UNIT_FIELD[fk]
--                 if fenum==nil then
--                     fenum=DMG_TYPE[fk]
--                 end
--                 if fenum~= nil then
--                     rs_str=rs_str..","..fenum.name..":"..fv
--                 end
--             end    
--         end
--     end    
--     return rs_str
-- end  


-- print(getItemFieldStr(tb))


